﻿using System;
using System.Windows;
using LayeredArchitectureSample.ViewModel;

namespace LayeredArchitectureSample.ClientBrowser
{
    public partial class WaresView : Window
    {
        private readonly WaresViewModel _viewModel;

        internal WaresView(WaresViewModel viewModel)
        {
            if (viewModel == null) throw new ArgumentNullException("viewModel");

            _viewModel = viewModel;

            this.DataContext = _viewModel;

            InitializeComponent();
        }

        private void RemoveItemButtonClick(object sender, RoutedEventArgs e)
        {
            _viewModel.RemoveSelectedWare();
        }

        private void AddNewWareButtonClick(object sender, RoutedEventArgs e)
        {
            _viewModel.AddNewWare();
        }

        private void CloseDownButtonClick(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}